//
//  SEGHTTPBusinessManager.h
//  SEGBasicBussiness
//
//  Created by 刘山 on 2018/3/14.
//  Copyright © 2018年 刘山. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SEGHTTPManager.h"
#import "SEGServerManager.h"

#define kNetworkErrorMessage @"网络不太好，请稍后继续"

typedef void (^SEGReponseBlock)(BOOL isSuccessed,
                                  id result,
                                  NSString* codeType,
                                  NSError* error);

typedef void (^SEGNetworkReponse)(BOOL isSuccessed,
                                  id result,
                                  NSString* codeType,
                                  NSString* errorMessage);

typedef void (^SEGRequestCallBack)(BOOL isSuccessed,
                                   NSString* codeType,
                                   NSString* errorMessage);

@interface SEGHTTPBusinessManager : NSObject
/**
 多文件上传-SEGUploadFileModel
 */
+(void)seg_uploadDatasWithURLString:(NSString*)URLString parameters:(id)parameters detailSources:(NSArray<SEGUploadFileModel*>*)detailSources progress:(void(^)(double progressValue))progress completed:(SEGReponseBlock)completed;

/**
 图片上传-单图-有默认图片名
 */
+(void)seg_uploadImageWithURLString:(NSString*)URLString parameters:(id)parameters source:(NSData*)source progress:(void(^)(double progressValue))progress completed:(SEGReponseBlock)completed;

/**
 图片上传-单图-需要输入图片名
 */
+(void)seg_uploadImageWithURLString:(NSString*)URLString parameters:(id)parameters source:(NSData*)source fileName:(NSString*)fileName progress:(void(^)(double progressValue))progress completed:(SEGReponseBlock)completed;
/**
 图片上传-多图-NSData
 */
+(void)seg_uploadImagesWithURLString:(NSString*)URLString parameters:(id)parameters sources:(NSArray<NSData*>*)sources progress:(void(^)(double progressValue))progress completed:(SEGReponseBlock)completed;


/**
 上传多个mp3资源
 */
+(void)seg_uploadVoicesWithURLString:(NSString*)URLString parameters:(id)parameters sources:(NSArray<NSData*>*)sources progress:(void(^)(double progressValue))progress completed:(SEGReponseBlock)completed;

/**
 上传单个mp3资源-默认文件名
 */
+(void)seg_uploadVoiceWithURLString:(NSString*)URLString parameters:(id)parameters source:(NSData*)source progress:(void(^)(double progressValue))progress completed:(SEGReponseBlock)completed;

/**
 上传单个mp3资源-需要输入文件名
 */
+(void)seg_uploadVoiceWithURLString:(NSString*)URLString parameters:(id)parameters source:(NSData*)source fileName:(NSString*)fileName progress:(void(^)(double progressValue))progress completed:(SEGReponseBlock)completed;

+(void)seg_serRequestHeaderDictionary:(NSDictionary*)headers;

/**
 * 浅层网络请求封装
 * 目的：网络请求可以集中处理，也可以解耦
 * 每个网络请求都附带一个模型文件承载服务器返回的数据
 * @author Sam
 * @see 使用网络请求之前先设置请求域名，+(void)segInitClientDomain:、+(void)segInitBrowerDomain:
 */
+(void)seg_requestWithMethod:(SEGHTTPSessionManagerRequestMethod)method URLString:(NSString*)URLString parameters:(id)parameters completed:(SEGReponseBlock)completed;

/**
 * 浅层网络请求封装-JSON 数据上传
 * 目的：网络请求可以集中处理，也可以解耦
 * 每个网络请求都附带一个模型文件承载服务器返回的数据
 * @author Sam
 * @see 使用网络请求之前先设置请求域名，+(void)segInitClientDomain:、+(void)segInitBrowerDomain:
 */
+(void)seg_requestJSONWithMethod:(SEGHTTPSessionManagerRequestMethod)method URLString:(NSString*)URLString parameters:(id)parameters completed:(SEGReponseBlock)completed;

/* ---------------拆包之前的网络请求-------------*/
+(void)seg_requestWithMethod:(SEGHTTPSessionManagerRequestMethod)method URLString:(NSString*)URLString parameters:(id)parameters finished:(SEGNetworkReponse)finished;
+(void)seg_requestJSONWithMethod:(SEGHTTPSessionManagerRequestMethod)method URLString:(NSString*)URLString parameters:(id)parameters finished:(SEGNetworkReponse)finished;
/**
 * 招商局请求 到家汇
 * @author Sam
 */
+ (void)seg_requestMerchantWithMethod:(SEGHTTPSessionManagerRequestMethod)method
                            URLString:(NSString*)URLString
                           parameters:(id)parameters
                            dataClass:(Class)className
                             finished:(SEGNetworkReponse)finished;
@end
